import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import About from '@/第七天作业/练习题4/About'
import Contacts from '@/第七天作业/练习题4/Contacts'
import Uirouter from '@/第七天作业/练习题4/UI_Router'
import allContacts from '@/第七天作业/练习题4/Scond/allContacts'
import alice from '@/第七天作业/练习题4/Scond/alice'
import bob from '@/第七天作业/练习题4/Scond/bob'
import Blog from '@/第七天作业/练习题4/Scond/BOB/Blog'
import Fax from '@/第七天作业/练习题4/Scond/BOB/Fax'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect: '/uirouter',
  },
  {
   path:'/uirouter',
   name: 'uirouter',
   component:Uirouter,
  },
  {
   path:'/about',
   name: 'about',
   component:About,
  },
  {
   path:'/contacts',
   name: 'contacts',
   component: Contacts,
   redirect:'contacts/allcontacts',
    children: [
      {
        path: 'allcontacts',
        name:'allContacts',
        component:allContacts,
      },
      {
        path: 'alice',
        name:'alice',
        component:alice,
      },
      {
        path: 'bob',
        name:'bob',
        component: bob,
        children: [
          {
            path: 'blog',
            name: 'Blog',
            component:Blog,
          },
          {
            path: 'fax',
            name: 'Fax',
            component:Fax,
          },
        ]
      }
    ]
  }
]

const router = new VueRouter({
   routes
})

// 全局指令
Vue.directive("focus", {
  inserted(el){
    el.focus()
  }
})

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
